package com.geostar.constructionland.attachment.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @Author makoto_zhu
 * @Date 2021-01-18 10:41:17
 * @Description 增加Swagger文档配置
 **/
@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket docket() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.geostar.constructionland.attachment.controller"))
                .paths(PathSelectors.any())
                .build();
    }

    @Bean
    public ApiInfo apiInfo() {
        /**设置联系信息**/
        Contact contact = new Contact("yell", "https://www.geostart.com.cn", "373156680@qq.com");
        return new ApiInfoBuilder()
                .title("分析接口文档")
                .description("广东省土地决策平台接口说明")
                .contact(contact)
                .version("1.0")
                .build();
    }
}
